*this do file creates the share of the occupation in the focal year using the fixed national industry by occupation distribtion in the focal year

clear


// Load Data

use "$dir/data/interim/occ_by_ind_weights_by_year.dta" 
keep if year == 2000

tempfile weights2000
save `weights2000'

use "$dir/data/interim/ind_cz_weights_2000.dta", clear



*note: want to merge each czone by industry in master to an occupation by industry, so need to use joinby
joinby ind1990 using `weights2000'

*then want to collapse using the industry shares to get the occupation share within the czone

collapse occ_share occ_share_oas [aweight= ind_share], by(year occ2010 czone)


	
	rename occ2010 census2010
	
	sort census2010 czone

save "$dir/data/interim/fixed_ind_czone_occ_weight_2000.dta", replace



*now lets do the 1970s


clear

// Load Data

use "$dir/data/interim/occ_by_ind_weights_by_year.dta" 
keep if year == 1970

tempfile weights1970
save `weights1970'

use "$dir/data/interim/ind_cz_weights_1970.dta", clear


*note: want to merge each czone by industry in master to an occupation by industry, so need to use joinby
joinby ind1990 using `weights1970'


collapse occ_share occ_share_oas [aweight= ind_share], by(year occ2010 czone)


	
	rename occ2010 census2010
	
	sort census2010 czone

save "$dir/data/interim/fixed_ind_czone_occ_weight_1970.dta", replace


